/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mx.saco.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author jethro.gutierrez
 */
@Entity
@Table(name = "tt_concepto")
@NamedQueries({
    @NamedQuery(name = "Concepto.findAll", query = "SELECT c FROM Concepto c"),
    @NamedQuery(name = "Concepto.findByIdConcepto", query = "SELECT c FROM Concepto c WHERE c.idConcepto = :idConcepto"),
    @NamedQuery(name = "Concepto.findByClave", query = "SELECT c FROM Concepto c WHERE c.clave = :clave"),
    @NamedQuery(name = "Concepto.findByDescripcion", query = "SELECT c FROM Concepto c WHERE c.descripcion = :descripcion"),
    @NamedQuery(name = "Concepto.findByPrecio", query = "SELECT c FROM Concepto c WHERE c.precio = :precio"),
    @NamedQuery(name = "Concepto.findByFechaAlta", query = "SELECT c FROM Concepto c WHERE c.fechaAlta = :fechaAlta")})
public class Concepto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_concepto")
    private Integer idConcepto;
    @Column(name = "clave")
    private String clave;
    @Column(name = "descripcion")
    private String descripcion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "precio")
    private Double precio;
    @Column(name = "fecha_alta")
    @Temporal(TemporalType.DATE)
    private Date fechaAlta;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "concepto")
    private List<ComprobanteConcepto> comprobanteConceptoList;
    @JoinColumn(name = "periodicidad", referencedColumnName = "id_elemento")
    @ManyToOne
    private Elemento periodicidad;
    @JoinColumn(name = "id_unidad_habitacional", referencedColumnName = "id_unidad_habitacional")
    @ManyToOne
    private UnidadHabitacional idUnidadHabitacional;

    public Concepto() {
    }

    public Concepto(Integer idConcepto) {
        this.idConcepto = idConcepto;
    }

    public Integer getIdConcepto() {
        return idConcepto;
    }

    public void setIdConcepto(Integer idConcepto) {
        this.idConcepto = idConcepto;
    }

    public String getClave() {
        return clave;
    }

    public void setClave(String clave) {
        this.clave = clave;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Double getPrecio() {
        return precio;
    }

    public void setPrecio(Double precio) {
        this.precio = precio;
    }

    public Date getFechaAlta() {
        return fechaAlta;
    }

    public void setFechaAlta(Date fechaAlta) {
        this.fechaAlta = fechaAlta;
    }

    public List<ComprobanteConcepto> getComprobanteConceptoList() {
        return comprobanteConceptoList;
    }

    public void setComprobanteConceptoList(List<ComprobanteConcepto> comprobanteConceptoList) {
        this.comprobanteConceptoList = comprobanteConceptoList;
    }

    public Elemento getPeriodicidad() {
        return periodicidad;
    }

    public void setPeriodicidad(Elemento periodicidad) {
        this.periodicidad = periodicidad;
    }

    public UnidadHabitacional getIdUnidadHabitacional() {
        return idUnidadHabitacional;
    }

    public void setIdUnidadHabitacional(UnidadHabitacional idUnidadHabitacional) {
        this.idUnidadHabitacional = idUnidadHabitacional;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idConcepto != null ? idConcepto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Concepto)) {
            return false;
        }
        Concepto other = (Concepto) object;
        if ((this.idConcepto == null && other.idConcepto != null) || (this.idConcepto != null && !this.idConcepto.equals(other.idConcepto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mx.saco.entity.Concepto[ idConcepto=" + idConcepto + " ]";
    }
    
}
